package com.manager.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.manager.cms.bo.SysAdmin;
import com.manager.cms.common.Pageable;
import com.manager.cms.mapper.SysAdminMapper;
import com.manager.cms.service.SysAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author 
 * @version v1.0
 * @date 2020-05-19
 */
@Service
public class SysAdminServiceImpl implements SysAdminService {

    @Autowired
    private SysAdminMapper sysAdminMapper;

    @Override
    public void insert(SysAdmin record) {
        sysAdminMapper.insert(record);
    }

    @Override
    public void update(SysAdmin record){
        sysAdminMapper.update(record);
    }

    @Override
    public void del(String id){
        sysAdminMapper.del(id);
    }

    @Override
    public SysAdmin selectByPrimaryKey(String id){
        return sysAdminMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SysAdmin> getList(SysAdmin record){
        return sysAdminMapper.selectByRecord(record);
    }

    @Override
    public Pageable<SysAdmin> pageList(SysAdmin record, Integer pageNum, Integer pageSize){
        Integer count = sysAdminMapper.countByRecord(record);
        PageHelper.startPage(pageNum, pageSize);
        List<SysAdmin> list = sysAdminMapper.selectByRecord(record);
        return new Pageable<>(list, count, pageSize, pageNum);
    }

}